package com.globallogic.javatraining.liudmyla_shapoval.uni.resources;

import com.globallogic.javatraining.liudmyla_shapoval.uni.people.Student;
import com.globallogic.javatraining.liudmyla_shapoval.uni.people.Teacher;

public class Course {

	private String subject;
	private Teacher teacher;
	private Lesson[] lessons;
	private Student[] enrolledStudents;
	int id = 0;

	public Course(String subject) {
		this.subject = subject;
	}

	public Teacher getTeacher() {
		return teacher;
	}

	public Student[] getEnrolledStudents() {
		return enrolledStudents;

	}

	public boolean hasEnrollments() {
		return (enrolledStudents != null);
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	@Override
	public boolean equals(Object object) {
		if (object == this) {
			return true;
		}

		if (object == null) {
			return false;
		}

		if (!(getClass() == object.getClass())) {
			return false;
		} else {
			Course course = (Course) object;
			if (course.getSubject() == this.getSubject())
				return true;
			else
				return false;
		}
	}

	public int numberOfLessons() {
		return lessons.length;
	}

	public String getSubject() {
		return subject;
	}
	
	public int getId() {
		return id;
	}

	public void setId() {
		this.id = id++;
	}


}
